package BehavioralModel.StrategyPattern;

/**
 * @author 王蕾 [wanglei_dev@cyou-inc.com]
 * @date 2017-12-07 15:12:00
 */
public class CashReturn implements CashStrage {

    //返利条件
    private double moneyCondition = 0.0d;
    //具体返回多少钱
    private double moneyReturn = 0.0d;

    public CashReturn(double moneyCondition, double moneyReturn) {
        this.moneyCondition = moneyCondition;
        this.moneyReturn = moneyReturn;
    }

    @Override
    public double acceptCash(double money) {
        double result = money;
        if (money > moneyCondition){
            return money -  moneyReturn;
        }
        return result;
    }
}
